Command Line Support

Overview

Capella provides the capacity to launch actions from command line. Potential actions are model validation, HTML production and XML export.

The core mechanism provides the following parameters:

Mandatory parameters:

This behavior can be overridden by applications.


Optional parameters:


  • Default behaviour of command line support checks that the workspace specified for validation result and HTML report generation is not in use by another instance of Eclipse.

  • Be careful to use a Capella version that is compatible with the Java Runtime Environment (i.e. run Capella 32 bits on a 32 bits JVM and Capella 64 bits on 64 bits JVM).

  • If the path to the aird file or the path to the workspace or the path to the log file contains white space, it should be in quotes (eg: -data “D: \Application Data\workspace”)

  • When Capella is run in command line, logs levels INFO, WARN, ERROR, FATAL are automatically activated for File and Console appender (regardless of the current log configuration stored in %USERPROFILE%\ReportConfiguration.xml)

  • Before running below commands make sure to not have newline between each parameters to avoid copy/paste errors.


Command Line Application Examples

Model Validation

Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.core.validation.commandline

-data <workspacePath>

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/validation

-logfile D:\CommandLineLog\log.html


This command validates the model corresponding to the <workspacePath>/EOLE_AF/EOLE_AF.aird file and generates a report to the output folder <workspacePath>/DocProject/validation.

DocProject must be a general Eclipse project (not a directory) initially created into the specified workspace, with inside a folder named validation. As well, EOLE_AF must exist as Capella project inside the same workspace. A log file can be also specified with the parameter -logfile



Complex use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.core.validation.commandline

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/validation

-forceoutputfoldercreation

-validationruleset D:/EPF/exportall.epf

-validationcontext "EOLE_AF/EOLE_AF.melodymodeller#971d9934-9780-4e41-b02e-312d0eac3223 |

EOLE_AF EOLE_AF/fragments/OA-Operational%20Context-Operational%20Entity.melodyfragment#c6aebe52-c8a4-4d35-8105-177c87470bef "

-data <workspacePath>

-logfile D:\CommandLineLog\log.html

This new command uses a -validationruleset parameter to specify the path to an Eclipse Property File (epf file) and a -validationcontext parameter to specify the set of URIs of model elements to validate. The set of rule to validate against are stored into the exported epf file.

The parameter -forceoutputfoldercreation becomes necessary for the following cases :

A log file is also specified.



HTML Production



Prerequisites: XHTML Add-on has to be installed.



Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <workspacePath>

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/HTML

-forceoutputfoldercreation

This command will generate HTML report from the EOLE-AF aird file specified to the output folder HTML present into Doc project.


Complex use cases:

</br>

Import Capella project and generate inside it

</br>

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <targetWorkspacePath>

-import <absolutePath>/EOLE_AF

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /EOLE_AF/HTML

-forceoutputfoldercreation

-logfile D:/CommandLineLog/log.html

This command will import the EOLE_AF project from <absolutePath> workspace into <targetWorkspacePath> workspace before generating the HTML report inside it.

</br>

Import Capella project and generate inside a new project

</br>

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <targetWorkspacePath>

-import <absolutePath>/EOLE_AF

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/HTML

-forceoutputfoldercreation

-logfile D:/CommandLineLog/log.html

This command will import the EOLE_AF project from <absolutePath> workspace into <targetWorkspacePath> workspace and create the DocProject to generate the HTML report inside it.


Import Capella project and a Doc project to generate inside it


<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <targetWorkspacePath>

-import "<absolutePath>/EOLE_AF | <absolutePath>/DocProject"

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/HTML

-forceoutputfoldercreation

-logfile D:/CommandLineLog/log.html

This command will import two projects (EOLE_AF and DocProject) from <absolutePath> workspace into <targetWorkspacePath> workspace before generating the HTML report inside the DocProject.

NOTE: The source and target workspaces have to be different.



XML Export



Prerequisites: XML Pivot Add-on has to be installed.



Another Capella headless commandline application is the XML export. The following command runs an export in headless mode:

<CapellaInstallationPath>/eclipse.exe -consoleLog -nosplash

-application org.polarsys.capella.core.commandline.core

-appid xmlpivot.export

-filepath <Path>

The filepath argument may either be a relative or an absolute path. If it is a relative path, it is interpreted relative to the workspace. To specify an explicit workspace, you can use the –data parameter.

Simple use cases:

<CapellaInstallationPath>/eclipse.exe -consoleLog –nosplash

-application org.polarsys.capella.core.commandline.core

-appid xmlpivot.export

-filepath C:/EOLE_AF/EOLE_AF.melodymodeller

This command exports a capella model into an xml file stored at filepath path.


Export as ZIP


This command will export selected project to the given zip filename

Mandatory parameters:


(usage of “qualifier” in the output file name will be replaced by current date/time)

Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.core.commandline.core.exportZip

-data <workspacePath>

-export "EOLE_AF"

-exportZipName "/EOLE_AF/EOLE_qualifier.zip"

-filepath "/EOLE_AF/EOLE_AF.aird"

-outputfolder "/EOLE_AF/output"

-forceoutputfoldercreation

-logfile "D:\ CommandLineLog \log.html"